package com.chatroomdemo.pojo.response;

import com.chatroomdemo.enums.ResultCodeEnum;
import lombok.Data;

@Data
public class Result {
    private ResultCodeEnum code;//业务状态码
    private String errMsg;
    private Object data;


    public static Result SUCCESS(Object data){
        Result result = new Result();
        result.setCode(ResultCodeEnum.SUCCESS);
        result.setErrMsg("");
        result.setData(data);
        return result;
    }

    public static Result fail(String errMsg){
        Result result = new Result();
        result.setCode(ResultCodeEnum.FAil);
        result.setErrMsg(errMsg);
        return result;
    }

    public static Result fail(String errMsg,Object data){
        Result result = new Result();
        result.setCode(ResultCodeEnum.FAil);
        result.setErrMsg(errMsg);
        result.setData(data);
        return result;
    }
}
